package com.micro.service.rpc;

import com.micro.service.entity.ResponseMessage;
import com.micro.service.model.UserArticle;
import com.micro.service.rpc.fallback.RpcUserArticleFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Create by Vic Xu on 2019/3/24
 */
@FeignClient(value = "producer-main", fallback = RpcUserArticleFallback.class)
public interface RpcUserArticle {

    @GetMapping(value = "v1/user/article", produces = {"application/json;charset=UTF-8"})
    public ResponseMessage<List<UserArticle>> getAll();

    @PostMapping(value = "v1/user/article/one", produces = {"application/json;charset=UTF-8"})
    public ResponseMessage<List<UserArticle>> findByCardId(@RequestBody UserArticle userArticle);

    @PostMapping(value = "v1/user/article", produces = {"application/json;charset=UTF-8"})
    public ResponseMessage<UserArticle> saveUserArticle(@RequestBody UserArticle userArticle);

    @PutMapping(value = "v1/user/article", produces = {"application/json;charset=UTF-8"})
    public ResponseMessage<UserArticle> updateUserArticle(@RequestBody UserArticle userArticle);

    @DeleteMapping(value = "v1/user/article/{id}", produces = {"application/json;charset=UTF-8"})
    public ResponseMessage<String> deleteUserArticle(@PathVariable("id") String id);
}
